LIBEVENT_DIR    =       ~/libevent
LIBRB_DIR	=	~/libredblack-1.3
ALL_DIR		=	/lib
CFLAGS			=	-O2 -Wall  -I../include/ -I$(LIBEVENT_DIR) -I$(LIBRB_DIR)  -I$(ALL_DIR) -lm
LIBS                    =       ~/libevent/.libs/libevent.a  
REDBLACK = ~/libredblack-1.3/.libs/libredblack.a
R			=	~/libredblack-1.3/.libs/libredblack.a
ALL			=	/lib/libm-2.7.so
QUIET			=	@

SNAME			:= 	$(shell uname)
ifeq ($(strip $(SNAME)),Linux)
EXTRALIB 		= 	-lrt
endif


SRC		:= $(shell find . -name "[a-zA-Z]*.c" -print0 | xargs -0)
OBJECTS		= $(subst .c,.o,$(SRC))

.PHONY: clean
	
all: $(MODULE)

%.o: %.c
	@echo "> $@ <"
	$(QUIET) gcc -c $(CFLAGS) $^ 
	
$(MODULE): $(OBJECTS)
	@echo "+ $@ +"
	$(QUIET) gcc -o $@ $(CFLAGS) $^ $(LIBS) $(EXTRALIB) $(REDBLACK)
	
clean:
	@echo "Cleaning $(MODULE)"
	$(QUIET) rm -rf $(OBJECTS) $(MODULE)
